import request from '@/config/axios'

/** 学年及班级信息信息 */
export interface AcademicYear {
          yearId: number; // 学年唯一ID (注意：前端number类型可以处理Long)
          schoolId: number; // 学校ID
          schoolYear?: string; // 学年，如2024-2025
          termName?: string; // 学期名称
          termCode?: string; // 学期代码
          startDate?: string; // 开始日期
          endDate?: string; // 结束日期
          weeksCount?: number; // 周数统计
          isCurrent?: boolean; // 是否当前学期
          status?: number; // 状态（0=禁用 1=启用）
  }

// 学年及班级信息 API
export const AcademicYearApi = {
  // 查询学年及班级信息分页
  getAcademicYearPage: async (params: any) => {
    return await request.get({ url: `/ao/academic-year/page`, params })
  },

  // 查询学年及班级信息详情
  getAcademicYear: async (id: number) => {
    return await request.get({ url: `/ao/academic-year/get?id=` + id })
  },

  // 新增学年及班级信息
  createAcademicYear: async (data: AcademicYear) => {
    return await request.post({ url: `/ao/academic-year/create`, data })
  },

  // 修改学年及班级信息
  updateAcademicYear: async (data: AcademicYear) => {
    return await request.put({ url: `/ao/academic-year/update`, data })
  },

  // 删除学年及班级信息
  deleteAcademicYear: async (id: number) => {
    return await request.delete({ url: `/ao/academic-year/delete?id=` + id })
  },

  /** 批量删除学年及班级信息 */
  deleteAcademicYearList: async (ids: number[]) => {
    return await request.delete({ url: `/ao/academic-year/delete-list?ids=${ids.join(',')}` })
  },

  // 导出学年及班级信息 Excel
  exportAcademicYear: async (params) => {
    return await request.download({ url: `/ao/academic-year/export-excel`, params })
  },
}
